Page({
  data: {
		welcomeText: '早上好！张三先生',
		tipCount: 99,
		bannerList: [
      '/assets/banner.png', '/assets/banner.png','/assets/banner.png',
      '/assets/banner.png', '/assets/banner.png'
		],
		classifyList: [
			{icon: 'icon-list', text: '功能1', color: '#f69661'}, {icon: 'icon-xinfeng', text: '功能2', color: '#ff9702'},
			{icon: 'icon-kuoyinqi', text: '功能3', color: '#4eeaab'}, {icon: 'icon-zhifeiji', text: '功能4', color: '#4cd1d0'},
			{icon: 'icon-computer', text: '功能5', color: '#cbe4fe'},
		],
		pointList: [
			{icon: 'icon-computer', text: '功能A', color: '#cbe4fe'}, {icon: 'icon-kuoyinqi', text: '功能B', color: '#4eeaab'},
			{icon: 'icon-list', text: '功能C', color: '#f69661'}, {icon: 'icon-zhifeiji', text: '功能D', color: '#4cd1d0'},
			{icon: 'icon-computer', text: '功能E', color: '#cbe4fe'}, {icon: 'icon-xinfeng', text: '功能F', color: '#ff9702'},
			{icon: 'icon-zhifeiji', text: '功能G', color: '#4cd1d0'}, {icon: 'icon-xinfeng', text: '功能H', color: '#ff9702'},
			{icon: 'icon-kuoyinqi', text: '功能I', color: '#4eeaab'}, {icon: 'icon-list', text: '功能J', color: '#f69661'},
		],
		pointBList: [
			{icon: 'icon-kuoyinqi', text: '功能1', color: '#4eeaab'}, {icon: 'icon-kuoyinqi', text: '功能2', color: '#4eeaab'},
			{icon: 'icon-kuoyinqi', text: '功能3', color: '#4eeaab'}, {icon: 'icon-kuoyinqi', text: '功能4', color: '#4eeaab'},
			{icon: 'icon-kuoyinqi', text: '功能5', color: '#4eeaab'}, {icon: 'icon-kuoyinqi', text: '功能6', color: '#4eeaab'},
			{icon: 'icon-kuoyinqi', text: '功能7', color: '#4eeaab'}, {icon: 'icon-kuoyinqi', text: '功能8', color: '#4eeaab'},
			{icon: 'icon-kuoyinqi', text: '功能9', color: '#4eeaab'}, {icon: 'icon-kuoyinqi', text: '功能10', color: '#4eeaab'},
		],
		showDialog: false,
		dialogTitle: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
		this.fillPointList()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
		if (typeof this.getTabBar === 'function' && this.getTabBar()) {
			const { currentTab } = this.getTabBar().data
			this.getTabBar().setData({ currentTab })
		}
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

	},
	// 用于功能点区域 flex 布局占位
	fillPointList() {
		const { pointList } = this.data
		const num = pointList.length % 4
		if (num !== 0) {
			for (let i = 0; i < 4-num; i ++) {
				pointList.push({})
			}
			this.setData({ pointList })
		}
	},
	// 显示弹窗
	showDialog(e) {
		const { text } = e.currentTarget.dataset
		this.setData({ dialogTitle: text, showDialog: true })
		// 隐藏 TabBar
		if (typeof this.getTabBar === 'function' && this.getTabBar()) {
			this.getTabBar().setData({ showTabBar: false })
		}
	},
	// 关闭弹窗
	closeDialog() {
		this.setData({ showDialog: false })
		this.getTabBar().setData({ showTabBar: true })
  },
})